import React, { Component, createRef } from "react";

class App extends Component {
  state = {};
  file = createRef();

  submit = () => {
    // this.file.current.files可以获取到上传的内容
    console.log(this.file.current.files);
  };
  render() {
    return (
      <>
        <h2>非受控组件做文件上传框</h2>
        <input type="file" multiple ref={this.file} />
        <button onClick={this.submit}>上传</button>
      </>
    );
  }
}

export default App;
